<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>调息管理列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
          <div class="fieldBox" >
                <div class="label">融资机构</div>
                <%-- <div class="field">
                <select name="fundRasInsCd" id="fundRasInsCd" data-value=" " ligerui="width: 200">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${fundRasInsNmList }" var="fu">
                     		<option value="${fu.key }">${fu.value }</option>
                        </c:forEach>
                </select>
                </div> --%>
                <div class="field">
                    <input name="fundRasInsCd" id="fundRasInsCd" type="text" class="ui-textbox" value="" placeholder="请选择"  ltype="combobox">
                </div>
                <div style="display: none">
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="formBtns notRight">
                <span id="searchBtn" class="sq-button-round">查询</span>
            </div>
          </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>

<script type="text/javascript">
	var grid = null;
	$(function () {
		$("#searchBar").ligerForm({validate: true});
		initcombobox();//add by gengchunlan 20190606
		var _url = '<%=path%>/interest/management/initList.do';
    	$("#ligergrid1").ligerGrid({
    		url : _url,
    		method : 'get',
        	columns: [
	            { display: '状态', name: 'undueTimeType', align:'center',width: 80,
	            	render: function (rowdata, rowindex, value, column) { 
	            		if(StringUtils.isEmpty(value)){
	                		value = "";
	                	}
	                	var imgpath = '';
	                	if(rowdata.undueTimeType == 1){
	                		imgpath = '<%=path%>/resource/lib/images/greenpoticon.png';
	                	}else if(rowdata.undueTimeType == 2){
	                		imgpath = '<%=path%>/resource/lib/images/goldenpoticon.png';
	                	}else{
	                		imgpath = '<%=path%>/resource/lib/images/redpoticon.png';
	                	}
	                	var g = '<img alt="" width="20px" height="20px" src="'+imgpath+'">';         
		                return g;
            		}
	            },
	            { display: '金融机构', name: 'fundRasInsNm', width: 150},
	            { display: '项目编号', name: 'projId', width: 150},
	            { display: '项目名称', name: 'fncPrjNm', width: 150},
	            { display: '调息方式', name: 'intRatTypeNm', width: 80},
	            { display: '上次调试时间', name: 'preIntTm', width: 100, render:renderDate},
	            { display: '上次基准利率(%)', name: 'preIntRate', width: 100},
	            { display: '本次调息时间', name: 'thIntTm', width: 100, render:renderDate},
	            { display: '本次基准利率(%)', name: 'thIntRat', width: 100},
	            { display: '创建时间', name: 'crtTm', width: 100, render:renderDate},
	            { display: '操作', width: 130 ,height:'100px', align:'center',
	            	render: function (rowdata, rowindex, value){
	            		var h='<a href="javascript:showDetail(';
	            		h+="'"+rowdata.projId+"','"+ rowdata.id +"'";
	                    h+=')">还款表</a>';
	                    if(rowdata.isPranayama == 1){
		                    h+=' | ';
		                    h+='<a href="javascript:modifyRow(';
		                    h+="'"+rowdata.projId+"','"+ rowdata.id +"','" + rowdata.regId + "'";
		                    h+=')">调息</a>';
	                    }
	                	return h;
	            	}
	            }
	        ],
	        pageSize:10, 
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:false,
	        rownumbers:true

    	});
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();

		$("#searchBtn").click(function(event) {
			var form = liger.get("searchBar");
		    var data = form.getData();
		    for (var name in data){
		       grid.setParm(name,data[name]);
		    };
		   grid.reload();
		});
		
	});
	
	//查看数据
	function showDetail(_projId,_id){
		var params = "?id="+_id+"&projId="+_projId;
		Add_navTab('interest_management_info_view_'+_id,'查看还款表信息','<%=path%>/interest/management/viewRepaymentInfo.do'+params);
	}
	
	//修改
	function modifyRow(_projId,_id,_regId){
		var params = "?id="+_id+"&projId="+_projId+"&regId=" + _regId;
		Add_navTab('interest_management_modify_'+_id,'项目调息','<%=path%>/interest/management/projectInterest.do'+params);
	}
	
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	//融资机构 add by gengchunlan 20190606
	var frilist = [];
	<c:if test="${not empty frilist}"> frilist = ${frilist}; </c:if>
	 function initcombobox(){
		  var combobox=  $("#fundRasInsCd").ligerComboBox({
	    	     data:frilist,
	             selectBoxWidth: 270,
	             selectBoxHeight: 150,
	             valueField: "id",
	             textField: "fundRasInsNm",
	             autocomplete: function (e){
	                 filter_autoComboboxData(e.key, this);
	                 e.show();
	             }
	          });
	 }//end by  gengchunlan 20190606
	
</script>
</body>
</html>